package com.junyidao.game.Exception;

/**
 * Created by HP on 2016/8/11.
 */
public class BusinessException extends RuntimeException {
    private static final long serialVersionUID = -3297153548445915405L;
    private int code;
    private String msg;

    private BusinessException(int code, String msg) {
        super(msg);
        this.code = code;
        this.msg = msg;
    }

    private BusinessException(int code, String msg, Throwable exception) {
        super(msg, exception);
        this.code = code;
        this.msg = msg;
    }

    public static void throwException(int code, String msg) {
        throw new BusinessException(code, msg);
    }

    public static void throwException(int code, String msg, Throwable exception) {
        throw new BusinessException(code, msg, exception);
    }

    public int getCode() {
        return this.code;
    }

    public String getMessage() {
        return this.msg;
    }
}
